package com.woniu.service.impl;

import com.woniu.dao.IProductDao;
import com.woniu.entity.Product;
import com.woniu.service.IProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class ProductServiceImpl implements IProductService {
    @Autowired
    private IProductDao productDao;

    @Override
    public Product findByPid(Integer pid) {
        Optional<Product> optional = productDao.findById(pid);
        if (optional.isPresent()) {
            return optional.get();
        }
        return null;
    }
}